package com.lanou3g.code0413.file;

import java.io.File;
import java.io.IOException;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/13;
 * Otherwise, I don't know who created it either
 */

public class Test02 {
    public static void main(String[] args) {
        //文件夹的相对路径
        File parentPath = new File("res/txt/abc/cbc");
        //创建文件夹
        parentPath.mkdirs();

        File file = new File(parentPath,"aaa.txt");
        // 判断文件是否存在, 存在为true
        // 不存在 为false
        boolean exists = file.exists();
        System.out.println(exists);
        if (exists){
            file.delete();// 删除文件
        } else {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
